<template>
    <view class="globe_back">
        <view class="box">
            <view v-if="lists.order_status == 0&&lists.is_overtime==0">
                <u-count-down :time="30 * 60 * 60 * 1000" format="DD:HH:mm:ss" autoStart millisecond @change="onChange">
                    <view class="time fw_bold f_40">
                        待支付，剩余
                        <text class="time__item" style="color: #ff6401">{{ timeData.minutes }}&nbsp;</text>
                        分
                        <text class="time__item" style="color: #ff6401">{{ timeData.seconds }}&nbsp;</text>
                        秒
                    </view>
                </u-count-down>
            </view>
            <view v-if="lists.order_status == 1 && lists.rider_status == 0&&lists.is_overtime==0" class="fw_bold f_40">待提车，请尽快到店提车</view>
            <view v-if="lists.order_status == 1 && lists.rider_status == 4&&lists.is_overtime==0" class="fw_bold f_40">已完成，感谢您的使用</view>
			<view v-if="lists.order_status == 1 && lists.rider_status == 5" class="fw_bold f_40">售后处理中，请耐心等待</view>
            <view v-if="lists.is_overtime==1" class="fw_bold f_40">
                <text class="cl_FF6401">超时</text>
                归还，押金扣除
            </view>
            <view v-if="lists.order_status == 1 && lists.rider_status == 1&&lists.is_overtime==0" class="fw_bold f_40">
                使用中，{{lists.s_lease}}
            </view>
            <!-- 待收货商品 -->
            <view class="back_fff p_24 br_24 mt_24">
                <view class="flex">
                    <view>
                        <image class="shopImg" :src="lists.goods.gallery_images" mode="widthFix" v-if="lists.product_type==2"></image>
						<image class="shopImg" :src="lists.specifications.goods_image" mode="widthFix" v-if="lists.product_type==7"></image>
                    </view>
                    <view>
                        <view class="fw_bold f_32 listTitle" v-if="lists.product_type==2">{{lists.goods.license_plate_number}}</view>
						<view class="fw_bold f_32 listTitle" v-if="lists.product_type==7">{{lists.specifications.product_name}}</view>
                        <view class="flex justify_content_between">
                            <view class="cl_999CA3 mr_24 f_28" v-if="lists.product_type==2">车架号：{{lists.goods.frame_number}}</view>
                        </view>
                        <view class="flex justify_content_between mt_40 f_28">
                            <view class="flex" v-if="lists.product_type==2">
							  <view class="mintip" v-for="(item,index) in lists.goods.cz_label">{{item}}</view>
							
                                <!-- <view class="mintip">2年内新车</view>
                                <view class="mintip">小牛</view> -->
                            </view>
							<view class="flex" v-if="lists.product_type==7">
							  <view class="mintip" v-for="(item,index) in lists.specifications.guige">{{item}}</view>
							
							    <!-- <view class="mintip">2年内新车</view>
							    <view class="mintip">小牛</view> -->
							</view>
                            <view v-if="lists.product_type==2">￥{{lists.goods.moth_money}}</view>
							<view v-if="lists.product_type==7">￥{{lists.specifications.money}}</view>
                        </view>
                    </view>
                </view>
                <view class="flex justify_content_between f_28 mt_16">
                    <view class="storeAddress" v-if="lists.product_type==2">店铺地址：{{lists.address.address}}</view>
					<view class="storeAddress" v-if="lists.product_type==7">店铺地址：{{lists.specifications.address}}</view>
                    <u-icon name="arrow-right" size="16"></u-icon>
                </view>
            </view>

            <!-- 信息 -->
            <view class="detailedBox">
                <view class="flex justify_content_between detailed">
                    <view>租车类型</view>
                    <view>{{lists.lease_type}}</view>
                </view>
                <view class="flex justify_content_between detailed" v-if="lists.lease_type=='月租'">
                    <view>租用月数</view>
                    <view>{{lists.lease_term}}月</view>
                </view>
				<view class="flex justify_content_between detailed" v-if="lists.lease_type=='日租'">
				    <view>租用天数</view>
				    <view>{{lists.lease_term}}天</view>
				</view>
                <view v-if="payType == 2 || payType == 3" class="flex justify_content_between detailed">
                    <view>已使用时间</view>
                    <view>2月</view>
                </view>
                <view class="flex justify_content_between detailed">
                    <view>所在地区</view>
                    <view>{{lists.addresss}}</view>
                </view>
                <view class="flex justify_content_between detailed">
                    <view>详细地址</view>
                    <view>{{lists.detailed_address}}</view>
                </view>
                <view class="flex justify_content_between detailed">
                    <view>联系电话</view>
                    <view>{{lists.mobile}}</view>
                </view>
            </view>
            <view class="detailedBox">
                <view class="flex justify_content_between detailed">
                    <view>
                        押金
                        <text v-if="payType == 2">(已退)</text>
                        <text v-if="payType == 4">扣除</text>
                    </view>
                    <view>￥{{lists.money.deposit}}</view>
                </view>

                <view class="flex justify_content_between detailed">
                    <view>租金</view>
                    <view>￥{{lists.money.order_price}}</view>
                </view>
                <view class="flex justify_content_between detailed">
                    <view>优惠</view>
                    <view>￥{{lists.money.coupon_price}}</view>
                </view>
                <view class="flex justify_content_between detailed">
                    <view>合计</view>
                    <view class="fw_bold" style="color: #ff6401">￥{{lists.money.actual_price}}</view>
                </view>
            </view>
        </view>
        <view style="height: 150rpx"></view>
        <!-- 底部 -->
        <view v-if="lists.order_status == 0&&lists.is_overtime==0" class="button flex justify_content_between">
            <view class="TotalPrice">
                <view class="f_24">
                    合计：
                    <text style="color: #ff6401; font-size: 32rpx; font-weight: bold">{{lists.money.actual_price}}</text>
                </view>
                <view class="cl_999CA3 f_24 mt_16">
                    押金
                    <text class="cl_00091A">￥{{lists.money.deposit}}</text>
                    租金
                    <text class="cl_00091A">￥{{lists.money.order_price}}</text>
                    优惠
                    <text class="cl_00091A">￥{{lists.money.coupon_price}}</text>
                </view>
            </view>
            <view class="buy" @click="buy">立即付款</view>
        </view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            couponShow: false,
            Coupon: '',
            value: 0, //商品数量
            type: 0, //服务状态：0租用电池，1上门检修故障
            payType: 0, //支付状态：0待支付，1待接单
            timeData: {},
            url: '',
			lists:'',
			t:0,
            // 优惠券
            coupon: [
                {
                    name: '新人优惠券',
                    time: '2023-12-15',
                    title: '7折',
                    threshold: '无使用门槛',
                    disabled: false
                },
                {
                    name: '会员券',
                    time: '2023-12-25',
                    title: '8折',
                    threshold: '无使用门槛',
                    disabled: false
                }
            ]
        };
    },
    onShow() {
        this.url = this.baseUrl + this.imgPath;
    },
    onLoad(e) {
        console.log(e);
        this.payType = e.type;
		this.id=e.id
		this.t=e.t
		
		console.log(this.t);
		// if(e.t){
		// 	this.t=e.t
		// }
		// this.t=e.t
		this.list()
    },
    methods: {
		list(){
			this.$.ajax(1, "POST", "users/service_order", {
					order_id:this.id,
					lat:39.222,
					lng:117.333,
				}, (res) => {
					if(res.code==200){
						// this.$.ti_shi(res.msg)
						this.lists=res.data
						 // setTimeout(()=>{
							//  this.$emit('handleGetOrderList')
						 // },1000)
						 
					}else{
						this.$.ti_shi(res.msg)
					}
				})
		},
		buy() {
		    this.$.ajax(1, "POST", "users/go_pay", {
		    		order_id:this.id,
		    		// lat:39.222,
		    		// lng:117.333,
		    	}, (res) => {
		    		if(res.code==200){
		    			var that =this
		    			 uni.requestPayment({
		    			 	provider: "weixin",
		    			 	timeStamp: res.data.timeStamp,
		    			 	nonceStr: res.data.nonceStr,
		    			 	package: res.data.package,
		    			 	signType: res.data.signType,
		    			 	paySign: res.data.paySign,
		    			 	success: function (ress) {
		    			 		setTimeout(() => {
		    			 			uni.navigateBack({
		    			 				delta:1
		    			 			})
		    			 		}, 1000);
		    			 	},
		    			 	fail: function (err) {
		    			 		console.log(err)
		    			 		that.$.ti_shi(err)
		    			 					
		    			 	}
		    			 });
		    			 
		    		}else{
		    			this.$.ti_shi(res.msg)
		    		}
		    	})
		},

        onChange(e) {
            this.timeData = e;
        },
        submit() {
            this.couponShow = false;
        },
        valChange(e) {
            console.log('当前值为: ' + e.value);
        },
        // buy() {
        //     uni.navigateTo({
        //         url: '/pages/index/success'
        //     });
        // },
        address() {
            uni.navigateTo({
                url: '/pages/me/Address'
            });
        }
    }
};
</script>

<style scoped lang="scss">
.mintip {
    font-size: 20rpx;
    color: #3377ff;
    background: #f7faff;
    border-radius: 8rpx;
    padding: 8rpx 16rpx;
    margin-right: 8rpx;
}
.storeAddress {
    display: inline-block;
    white-space: nowrap;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.shopImg {
    width: 200rpx;
    height: 200rpx;
    border-radius: 16rpx;
    margin-right: 24rpx;
}
.listTitle {
    width: 400rpx;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tip {
    font-size: 24rpx;
    color: #999ca3;
    padding: 8rpx 16rpx;
    background: #f7faff;
    border-radius: 8rpx;
}
.minMoney {
    color: #ff6401;
    font-size: 32rpx;
    font-weight: bold;
}
.box {
    padding: 32rpx;
    .addTitle {
        font-size: 40rpx;
        color: #00091a;
        font-weight: bold;
    }
    .addText {
        font-size: 28rpx;
        color: #999ca3;
        margin-top: 16rpx;
    }
    .icon_r {
        width: 32rpx;
        height: 32rpx;
        vertical-align: middle;
        margin-top: 36rpx;
    }
    .address {
        background: white;
        border-radius: 16rpx;
        padding: 24rpx;
    }
    .coupon,
    .detailedBox {
        background: white;
        border-radius: 16rpx;
        padding: 24rpx;
        margin-top: 24rpx;
    }
    .ProductMap {
        width: 200rpx;
        height: 200rpx;
        border-radius: 16rpx;
    }
    .couT {
        width: 30%;
        margin: 16rpx 0;
        color: #333a47;
        font-size: 28rpx;
    }
    .coutext {
        width: 70%;
        padding: 16rpx 0;
        font-size: 28rpx;
        color: #ccced1;
    }
    .couponIcon {
        width: 32rpx;
        height: 32rpx;
        vertical-align: middle;
    }
    .detailed {
        color: #333a47;
        font-size: 28rpx;
        margin-bottom: 32rpx;
    }
}
.button {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16rpx 32rpx;
    background: #ffffff;
    .buy {
        width: 176rpx;
        height: 76rpx;
        line-height: 76rpx;
        text-align: center;
        color: white;
        border-radius: 8rpx;
        background-image: linear-gradient(to right, #ff924d, #ff6401);
    }
}
.title {
    font-size: 28rpx;
    color: #333a47;
}
.info {
    font-size: 28rpx;
    color: #00091a;
    margin-top: 32rpx;
}
.infoimg {
    width: 140rpx;
    height: 140rpx;
    border-radius: 16rpx;
    margin: 24rpx 12rpx;
}
.store {
    padding: 24rpx;
    background: white;
    border-radius: 24rpx;
    margin-top: 30rpx;
}
.storeImg {
    width: 96rpx;
    height: 96rpx;
    border-radius: 16rpx;
    margin-right: 16rpx;
}
.storeTitle {
    color: #00091a;
    font-size: 32rpx;
    margin-bottom: 8rpx;
}
.address {
    width: 48rpx;
    height: 48rpx;
    display: block;
    margin: 0 auto;
}
.addressText {
    color: #999ca3;
    font-size: 24rpx;
}
.salesVolume {
    color: #999ca3;
    font-size: 28rpx;
}
.couponBox {
    .discount {
        color: #ff6401;
        font-size: 24rpx;
        text-align: center;
    }
    .title {
        color: #00091a;
        font-size: 32rpx;
        margin-left: 66rpx;
    }
    .time {
        color: #999ca3;
        font-size: 28rpx;
        display: block;
        margin-top: 16rpx;
    }
}
.couponBtn {
    margin: 24rpx auto;
    width: 686rpx;
    height: 100rpx;
    border-radius: 24rpx;
    background: #3377ff;
    text-align: center;
    line-height: 100rpx;
    color: white;
    font-size: 32rpx;
    font-weight: bold;
}
</style>
